/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tcc.ejb.controleProjeto.entidade;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Maciel
 */
@Entity
@Table(name = "tarefa", catalog = "macielqs", schema = "controleprojeto")
@NamedQueries({
    @NamedQuery(name = "Tarefa.findAll", query = "SELECT t FROM Tarefa t"),
    @NamedQuery(name = "Tarefa.findById", query = "SELECT t FROM Tarefa t WHERE t.id = :id"),
    @NamedQuery(name = "Tarefa.findByNome", query = "SELECT t FROM Tarefa t WHERE t.nome = :nome"),
    @NamedQuery(name = "Tarefa.findByObservacao", query = "SELECT t FROM Tarefa t WHERE t.observacao = :observacao"),
    @NamedQuery(name = "Tarefa.findByProfissionalId", query = "SELECT t FROM Tarefa t WHERE t.profissionalId = :profissionalId"),
    @NamedQuery(name = "Tarefa.findByPrevIni", query = "SELECT t FROM Tarefa t WHERE t.prevIni = :prevIni"),
    @NamedQuery(name = "Tarefa.findByPrevFim", query = "SELECT t FROM Tarefa t WHERE t.prevFim = :prevFim"),
    @NamedQuery(name = "Tarefa.findByEfetIni", query = "SELECT t FROM Tarefa t WHERE t.efetIni = :efetIni"),
    @NamedQuery(name = "Tarefa.findByEfetFim", query = "SELECT t FROM Tarefa t WHERE t.efetFim = :efetFim"),
    @NamedQuery(name = "Tarefa.findByPorcConclusao", query = "SELECT t FROM Tarefa t WHERE t.porcConclusao = :porcConclusao")})
public class Tarefa implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "nome", nullable = false, length = 25)
    private String nome;
    @Basic(optional = false)
    @Column(name = "observacao", nullable = false, length = 2147483647)
    private String observacao;
    @Basic(optional = false)
    @Column(name = "profissional_id", nullable = false)
    private int profissionalId;
    @Basic(optional = false)
    @Column(name = "prev_ini", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date prevIni;
    @Basic(optional = false)
    @Column(name = "prev_fim", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date prevFim;
    @Column(name = "efet_ini")
    @Temporal(TemporalType.TIMESTAMP)
    private Date efetIni;
    @Column(name = "efet_fim")
    @Temporal(TemporalType.TIMESTAMP)
    private Date efetFim;
    @Basic(optional = false)
    @Column(name = "porc_conclusao", nullable = false)
    private int porcConclusao;
    @ManyToMany(mappedBy = "tarefaList")
    private List<Artefato> artefatoList;
    @JoinTable(name = "dependencia_tarefa", joinColumns = {
        @JoinColumn(name = "tarefa_filho_id", referencedColumnName = "id", nullable = false)}, inverseJoinColumns = {
        @JoinColumn(name = "tarefa_pai_id", referencedColumnName = "id", nullable = false)})
    @ManyToMany
    private List<Tarefa> tarefaList;
    @ManyToMany(mappedBy = "tarefaList")
    private List<Tarefa> tarefaList1;
    @ManyToMany(mappedBy = "tarefaList1")
    private List<Artefato> artefatoList1;
    @JoinColumn(name = "atividade_id", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private Atividade atividade;

    public Tarefa() {
    }

    public Tarefa(Integer id) {
        this.id = id;
    }

    public Tarefa(Integer id, String nome, String observacao, int profissionalId, Date prevIni, Date prevFim, int porcConclusao) {
        this.id = id;
        this.nome = nome;
        this.observacao = observacao;
        this.profissionalId = profissionalId;
        this.prevIni = prevIni;
        this.prevFim = prevFim;
        this.porcConclusao = porcConclusao;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getObservacao() {
        return observacao;
    }

    public void setObservacao(String observacao) {
        this.observacao = observacao;
    }

    public int getProfissionalId() {
        return profissionalId;
    }

    public void setProfissionalId(int profissionalId) {
        this.profissionalId = profissionalId;
    }

    public Date getPrevIni() {
        return prevIni;
    }

    public void setPrevIni(Date prevIni) {
        this.prevIni = prevIni;
    }

    public Date getPrevFim() {
        return prevFim;
    }

    public void setPrevFim(Date prevFim) {
        this.prevFim = prevFim;
    }

    public Date getEfetIni() {
        return efetIni;
    }

    public void setEfetIni(Date efetIni) {
        this.efetIni = efetIni;
    }

    public Date getEfetFim() {
        return efetFim;
    }

    public void setEfetFim(Date efetFim) {
        this.efetFim = efetFim;
    }

    public int getPorcConclusao() {
        return porcConclusao;
    }

    public void setPorcConclusao(int porcConclusao) {
        this.porcConclusao = porcConclusao;
    }

    public List<Artefato> getArtefatoList() {
        return artefatoList;
    }

    public void setArtefatoList(List<Artefato> artefatoList) {
        this.artefatoList = artefatoList;
    }

    public List<Tarefa> getTarefaList() {
        return tarefaList;
    }

    public void setTarefaList(List<Tarefa> tarefaList) {
        this.tarefaList = tarefaList;
    }

    public List<Tarefa> getTarefaList1() {
        return tarefaList1;
    }

    public void setTarefaList1(List<Tarefa> tarefaList1) {
        this.tarefaList1 = tarefaList1;
    }

    public List<Artefato> getArtefatoList1() {
        return artefatoList1;
    }

    public void setArtefatoList1(List<Artefato> artefatoList1) {
        this.artefatoList1 = artefatoList1;
    }

    public Atividade getAtividade() {
        return atividade;
    }

    public void setAtividade(Atividade atividade) {
        this.atividade = atividade;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tarefa)) {
            return false;
        }
        Tarefa other = (Tarefa) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tcc.ejb.controleProjeto.entidade.Tarefa[id=" + id + "]";
    }

}
